// 括号是否有效
function isValidAllBrackets(s) {
    const map = { "{": "}", "(": ")", "[": "]" };
    const stack = [];
    for (let i of s) {
        if (map[i]) {
            stack.push(i)
        } else {
            if (map[stack[stack.length - 1]] === i) {  // 判断是否找到了 } ）] 并与最近一个括号比较
                stack.pop()
            }
            // else {
            //     return false
            // }
        }
    }
    return stack.length === 0;
}

console.log(isValidAllBrackets("{{}}"))